/**
 * sub apps
 *
 * @author xiaomi
 */
'use strict';

const md5 = require('../utils/md5');
const {WEB, IOS, ANDROID} = require('./clients');
const APP_KEY = process.env.APP_KEY;
const apps = {
    [WEB.id]: {
        name: WEB.name
    },
    [IOS.id]: {
        name: IOS.name
    },
    [ANDROID.id]: {
        name: ANDROID.name
    },
    editor: {
        name: 'Editor'
    },
    ttxs: {
        name: 'TTXS'
    }
};

// assign id & secret
Object.keys(apps).forEach(id => {
    let app = apps[id];

    app.secret = md5(`${id}_${app.name}_${APP_KEY}`);
    app.id = id;
});

// console.log(apps);

module.exports = apps;
